<?php
    //print_r($this);exit;
    $_productCollection=$this->getLoadedProductCollection();
    //print_r($this->getToolbarHtml());exit;
 //print_r($_productCollection->getData());exit;
    $_helper = $this->helper('catalog/output');
    $_collectionSize = $_productCollection->count();
    $_columnCount = $this->getColumnCount();
   //echo $_columnCount;exit;
?>
<?php $_em0029Setting=new EM_EM0029Settings_EM0029Settings();?>
<?php if(!$_productCollection->count()): ?>

<p class="note-msg"><?php echo $this->__('There are no products matching the selection.') ?></p>
<?php else: ?>

<div class="category-products">

    <?php $i=0; foreach ($_productCollection as $_product): ?>
  
        <?php if ($i++%$_columnCount==0): ?>
        <h2 class="category-name"><?php echo Mage::getModel('catalog/category')->load($this->getData('category'))->getName();?></h2>
		<ul class="products-grid">
        <?php endif ?>
            <li class="item<?php if(($i-1)%$_columnCount==0): ?> first<?php elseif($i%$_columnCount==0): ?> last<?php endif; ?>">
                <div class="item_inner">
				<a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" class="product-image"><img <?php if($_em0029Setting->get_widget_bgcolor()) echo 'style="background-color:'.$_em0029Setting->get_widget_bgcolor().'"';?> src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize($_em0029Setting->get_widget_width(),$_em0029Setting->get_widget_height()); ?>" width="<?php echo $_em0029Setting->get_widget_width();?>" height="<?php echo $_em0029Setting->get_widget_height();?>" alt="<?php echo $this->stripTags($this->getImageLabel($_product, 'small_image'), null, true) ?>" /></a>
					<div class="product-details">
						<?php Mage::helper('productlabels')->display($_product)?>
						<h2 class="product-name"><a href="<?php echo $_product->getProductUrl() ?>" title="<?php echo $this->stripTags($_product->getName(), null, true) ?>"><?php echo $_helper->productAttribute($_product, $_product->getName(), 'name') ?></a></h2>
						<?php if($_product->getRatingSummary()): ?>
						<?php echo $this->getReviewsSummaryHtml($_product, 'short') ?>
						<?php endif; ?>		
						<?php echo $this->getPriceHtml($_product, true) ?>
						<?php if($_product->isSaleable()): ?>
                        <button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>
						<?php else: ?>
							<p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
						<?php endif; ?>
					</div>
				</div>
            </li>
        <?php if ($i%$_columnCount==0 || $i==$_collectionSize): ?>
        </ul>
        <?php endif ?>
        <?php endforeach ?>
        <script type="text/javascript">decorateGeneric($$('ul.products-grid'), ['odd','even','first','last'])</script>
		
</div>
<?php endif; ?>
